<html lang="en" xml:lang="en"><head>
<META http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><META name="description" content="Extend BaseWidget JavaScript is not a classical language. It is a prototypical object oriented language. As such, to make most developers comfortable with developing widgets, Web AppBuilder for ArcGIS uses Dojo's functions to create and extend classes. Web AppBuilder defines the BaseWidget class from which you create the child class, Widget. Open Widget.js in a text editor. The basic code for extending BaseWidget is: define(['dojo/_base/declare', 'jimu/BaseWidget'], function(declare, BaseWidget) { //To create a widget, you need to derive from BaseWidget. return declare([BaseWidget], { // DemoWidget code goes here }); }); The above code declares the"><meta name="content-language" content="en"><link href="rsrc/htmlhelp.css" rel="stylesheet" type="text/css"><title>Web AppBuilder for ArcGIS | Help - 
Extend BaseWidget
</title>
                <script type="text/javascript" language="JavaScript">
                    var pathL  = self.location.pathname.split ("/");
                    var fname = pathL[pathL.length-1];
                    var i = fname.lastIndexOf (".htm");
                    if (i>=0) {
                    fname = fname.substring (0, i)
                    } else {
                    //??
                    }
                    if (self.location.hash) {
				    		      fname = fname + self.location.hash;
						        }
                    self.location.replace ("../index.html#//" + fname);
                </script>
                </head><!--Publication GUID: [GUID-E7D1C130-8F87-4109-8D61-E73A46083F52]--><!--Topic GUID: [GUID-3E05319F-51CF-4665-8076-ADC0BDE99585]--><body><div id="content"><div class="header"><h1>
Extend BaseWidget
</h1><div id="breadcrumb"></div></div>
    <p id="GUID-40380C5C-865B-42DD-AF0B-1E1A74726A66">JavaScript is not a classical language. It is a prototypical
object oriented language. As such, to make most developers
comfortable with developing widgets, <span purpose="ph" varid="wab">Web AppBuilder for ArcGIS</span> uses
Dojo's functions to create and extend classes. <span purpose="ph" varid="wabshort">Web AppBuilder</span> defines the BaseWidget class from which you
create the child class, Widget.</p>
    <p id="GUID-595D569B-FBF9-40D3-AC9A-324373B6A013">Open Widget.js in a text editor. The basic code for extending
BaseWidget is:</p>
    <div class="codeblock" purpose="codeblock">
      
      <div class="highlight"><pre><code><span class="nx">define</span><span class="p">([</span><span class="s1">&#39;dojo/_base/declare&#39;</span><span class="p">,</span> <span class="s1">&#39;jimu/BaseWidget&#39;</span><span class="p">],</span>
<span class="kd">function</span><span class="p">(</span><span class="nx">declare</span><span class="p">,</span> <span class="nx">BaseWidget</span><span class="p">)</span> <span class="p">{</span>
  <span class="c1">//To create a widget, you need to derive from BaseWidget.</span>
  <span class="k">return</span> <span class="nx">declare</span><span class="p">([</span><span class="nx">BaseWidget</span><span class="p">],</span> <span class="p">{</span>
    <span class="c1">// DemoWidget code goes here </span>

  <span class="p">});</span>
<span class="p">});</span>
</code></pre></div>

    </div>
    <p id="GUID-F3756B56-38E8-4772-9F8A-4283EB4DAB11">The above code declares the DemoWidget class as a child class of BaseWidget. For more information, see <a target="_blank" class="xref" href="http://dojotoolkit.org/documentation/tutorials/1.8/declare/" rel="http://dojotoolkit.org/documentation/tutorials/1.8/declare/">dojo tutorials</a>.</p>
  <div class="footer"> Copyright © 1995-2016 Esri. All rights reserved. </div></div></body></html>